package com.china.zhuoyue.ui.activity.commom

import android.view.View
import com.china.zhuoyue.R
import com.china.zhuoyue.databinding.ActivityFeedbackBinding
import com.china.zhuoyue.ui.adapter.UserImageAdapter
import com.china.zhuoyue.ui.base.BaseActivity
import com.china.zhuoyue.ui.ext.toastMessageLong
import com.china.zhuoyue.ui.tool.image.select.ImageSelectBootstrap
import com.china.zhuoyue.ui.utils.FullyGridLayoutManager

class FeedbackActivity : BaseActivity<ActivityFeedbackBinding>() {
    override fun initView() {
        loadView {
            bindViewClick(buttonSubmit, cbFeedbackType1, cbFeedbackType2)

            rvImage.adapter = UserImageAdapter(imageSelect = ImageSelectBootstrap.get(mThis))
            rvImage.layoutManager = FullyGridLayoutManager(mThis, 3)
        }
    }

    override fun onClick(v: View?) {
        when (v) {
            vb.buttonSubmit -> {
                "提交成功".toastMessageLong()
                finish()
            }
            vb.cbFeedbackType1 -> {
                vb.ivFeedbackType1.setImageResource(R.mipmap.icon_login_check)
                vb.ivFeedbackType2.setImageResource(R.mipmap.icon_login_un_check)
            }
            vb.cbFeedbackType2 -> {
                vb.ivFeedbackType1.setImageResource(R.mipmap.icon_login_un_check)
                vb.ivFeedbackType2.setImageResource(R.mipmap.icon_login_check)
            }
        }
    }
}